import 'package:example/pages/pages/NewPage.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hx_base/pages/ScanPage.dart';
import 'package:hx_base/utils/LoggerUtil.dart';

class ClickScanPage extends StatelessWidget {
  const ClickScanPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("点击进入扫码界面"),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            Get.to(
              () => ScanPage(
                callbackResult: (qrString) {
                  Log.w("获取到扫码内容$qrString");
                  Future.delayed(const Duration(seconds: 3)).then((value) {
                    Get.off(() => NewPage());
                  });
                },
              ),
            );
          },
          child: Text("扫码"),
        ),
      ),
    );
  }
}
